/**
 * Copyright (c) 2007, Ashish Lijhara
 * All rights reserved.
 *
 * FontUtil.java
 *
 */

package crazy.java.Aetas;

import java.awt.Font;
import java.io.File;
import java.io.FileInputStream;
import javax.swing.JOptionPane;

/**
 *
 * @author Ashish (Java Crazy)
 */
public class FontUtil {
    
    /** Initialize */
    static Font dynamicFont32Pt;
    static Font dynamicFont;
    /** Gets the default font "defused.ttf" */
    public static Font getCompatiableFont(float size){
        doFileLoad("res/defused.ttf",size);
        return dynamicFont32Pt;
    }
    public static Font getCompatiableFont(String s,float size){
        doFileLoad(s,size);
        return dynamicFont32Pt;
    }
    /** Loads the specified Font File */
    public static void doFileLoad(String s,float size){
        try {File f = new File(s);
        FileInputStream in = new FileInputStream(f);
        dynamicFont =
                Font.createFont(Font.TRUETYPE_FONT, in);
        dynamicFont32Pt =
                dynamicFont.deriveFont(size);
        }catch(Exception e){
            new JOptionPane("Error");
        }
        
    }
    
}

